﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Threading;
using System.Windows.Threading;
namespace 橘子树chat
{
    /// <summary>
    /// InputVali.xaml 的交互逻辑
    /// </summary>
    public partial class InputVali : Window
    {
        String vali;
        public InputVali(String data)
        {
            vali = data;
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            InitializeComponent();
        }
        private System.Windows.Threading.DispatcherTimer dt = new DispatcherTimer();
        void dt_Tick(object sender, EventArgs e)
        {
            // 要执行的任务
            //toast_MissingInformation.Visibility = Visibility.Hidden;
            textBlock.Visibility = Visibility.Hidden;
            dt.Stop();
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (vali==textBox.Text)
            {
                DialogResult = true;
                this.Close();
            }
            else
            {
                textBlock.Visibility = Visibility.Visible;
                dt.Interval = TimeSpan.FromMilliseconds(2500);
                dt.Tick += new EventHandler(dt_Tick);
                dt.Start();
            }
        }

        private void label3_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DialogResult = false;
            this.Close();
        }
    }
}
